<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>

< DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="menu" content="assetMenu" />
<meta name="nav" content="0" />
<meta name="acc" content="_projectinfo" />
<title>工程管理</title>
<%-- ui tabs --%>
<script type="text/javascript"
	src="<c:url value='/ext/ui/jquery-ui-1.8.12.custom.min.js'/>"></script>
<script src="${ctx}/scripts/plugin/jquery.multiselect.min.js" type="text/javascript"></script>
<link href="${ctx}/styles/lightness/jquery-ui-1.8.12.custom.css"
	rel="stylesheet" />
<script>
/* 操作建设依据*/
 function operateBulidAcc(projtype){
	if("2"==projtype){
		 $("#buildAccording >td").remove();
		 $("#buildAccording").append(
			
				 	"<td>项目立项:</td>" +
					"<td ><input name=\"projApproval\" value=\"${projApproval}\"></input></td>" +
					"<td>工可批复</td>" +
					"<td><input name=\"projFeasible\" value=\"${projFeasible}\"></input></td> "
		 );
		 
		 $("#buildAccording").after(function(){
			 var content = "<tr id=\"buildAccording0\"><td>初步设计审查:</td>" +
					"<td ><input name=\"designCheck\" value=\"${designCheck}\"></input></td>"+
					"<td>施工图设计批复：</td>"+
					"<td ><input name=\"condrawingCheck\" value=\"${condrawingCheck}\"></input></td></tr>";
				return content;
		 });
		 
		 $("#budget").after(function(){
			 var signprice = "<tr id=\"signpricetr\"><td>合同价（万元）:</td>" +
					"<td><input name=\"signPrice\"  value=\"${signPrice}\" /></td></tr>";
			return signprice;
		 });
		 
		 $("#waterwayParam").show();
		 $("#waterwayParam  input").attr("disabled",false);
		 
		 $("#highway").hide();
		 $("#hidewayParam").hide();
		 $("#highway input").attr("disabled",true);
		 $("#hidewayParam  input").attr("disabled",true);
		 $("#hidewayParam  select").attr("disabled",true);
	}else{
		$("#buildAccording >td").remove();
		$("#buildAccording0").remove();
		$("#signpricetr").remove();
		$("#buildAccording").append(
				"<td>建设依据：</td>" +
				"<td colspan=\"3\"><textarea name=\"buildAccording\" rows=\"3\">${buildAccording}</textarea></td>"	
		);
		
		 //将水运类型表单隐藏且设为不可用
		 $("#waterwayParam").hide();
		 $("#waterwayParam  input").attr("disabled","disabled");
			
		 //将公路表单显示且可用
		 $("#highway").show();
		 $("#hidewayParam").show();
		 $("#highway input").attr("disabled",false);
		 $("#hidewayParam input").attr("disabled",false);
		 $("#hidewayParam select").attr("disabled",false);
	}
}

 function dealtime(time1,time2){
		//把时间按"_"切成数组
		    var ss1=time1.split("-");
		    var ss2=time2.split("-");
		//转为毫秒数
		    var btime=new Date(ss1[0],ss1[1]-1,ss1[2]);
		    var etime=new Date(ss2[0],ss2[1]-1,ss2[2]);
		    //计算相差天数
		    time=(etime.getTime()-btime.getTime())/(1000*24*60*60);
		    return time ;
	}

 
 function atTowncheck(){
	 var atv = $("a#atTown  input").val();
	 var   reg   =   new   RegExp(/[(^请选择)]/);   
	if(atv.search(reg)==-1){
		$("#msg").hide();
		return true;
	}else{
		$("#msg").show();
	}
	return false;
 };

$(document).ready(function() {
	 $( "#tabs" ).tabs().find( ".ui-tabs-nav" ).sortable({ axis: "x" });
	 $("#planStartDate").addClass("Wate").bind("click", function(){
	 WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd'});});
	 $("#planEndDate").addClass("Wate").bind("click", function(){
	 WdatePicker({skin:'whyGreen',minDate:'#F{$dp.$D(\'planStartDate\')}',dateFmt:'yyyy-MM-dd'});});
	 $("#acceptDate").addClass("Wate").bind("click", function(){
	 WdatePicker({skin:'whyGreen',maxDate:'%y-%M-%d',dateFmt:'yyyy-MM-dd'});});
	
		$("#atTown").multiSelect({ 
			minWidth:400,
			selectedList:5
		});
	 
 	$("#inputForm").validate({
 		errorContainer: "#error",
		errorLabelContainer:$("#error"),
		wrapper: "li",
 		rules:{
	 			projName:{
	 				required:true,
	 				remote:"${ctx}/project/projectinfo!findUnByProjName.action?oldProjName="+encodeURI('${projName}')
	 			},
				buildBackgroud:{
					required:true,
				},
				primeQuantity:{
					required:true
				},
				buildInvestment:{
					required:true,
					number:true
				},
				planInvestmentTotal:{
					required:true,
					number:true
				},
				tonnage:{
					digits:true
				},
				berthCount:{
					digits:true
				},
				principal :{
					required:true
				},
				techGrade:"required",
				socialLevel:"required"
		},
		messages: {
			projName:{
				required: "请在【基本信息】中填写 [ 项目名称  ] ",
				remote:"【基本信息】中[ 项目名称 ]已存在,请区别输入 "
			},
			buildBackgroud:"请在【规模概况】中填写[ 建设规模  ] ",
			primeQuantity:"请在【规模概况】中填写[ 主要工程量  ] ",
			buildInvestment:{
				required:"请在【规模概况】中填写[ 建安 投资 ] ",
				number:"【规模概况】中[ 建安 投资 ]只能输入数字 ",
			},
			planInvestmentTotal:{
				required:"请在【规模概况】中填写[ 工程概算 ] ",
				number:"【规模概况】中[ 工程概算 ]只能输入数字 ",
			},
			tonnage:"【主要技术标准】中[ 船舶停靠等级 ]只能输入数字 ",
			berthCount:"【主要技术标准】中[ 码头泊位数量 ]只能输入数字 ",
			principal :"请在【基本信息】中填写 [项目负责人 ] ",
			techGrade:"请在【主要技术标准】中选择[ 技术标准 ] ",
			socialLevel:"请在【主要技术标准】中选择[ 行政级别 ] "
		}
	});
 
 $("#showProjImp").click(function(){
	 	var url = "${ctx}/project/sign/build!input.action?id=${orgCode.id}&projectId=${id}";
		window.open(url, "signWindow") 
 });
 $("#addDrawingsContrct").click(function(){
		var url = "${ctx}/project/drawcontract!input.action?projectId=${id}";
	    mm = showDialogWindow(url);
 });
 
 //根据工程类型加载页面
 var projType = $("#projKind").val();
 if(projType=='2'){
	 operateBulidAcc("2");
 }else{
	 operateBulidAcc("1");
 }
 
 //工程类型改变时,加载页面数据不同
 $("#projKind").change(function(){
	 var val = $("#projKind").val();
	 if(val=='2'){
		 operateBulidAcc("2");
	 }else{
		 operateBulidAcc("1");
	 }
 });
 
 $("#duration").click(function(){
	 var sd = $("#planStartDate").val();
	 var ed = $("#planEndDate").val();
	 if(sd=='' || ed == '' ){
		 $("#duration").val(0);
	 }else{
		 $("#duration").val(dealtime(sd, ed));
	 }
});
 $("#msg").hide();
 $("#sub").bind('click',atTowncheck);
 $("#atTown").bind('click',atTowncheck);
});


</script>
</head>
<body>
<form action="projectinfo!save.action" method="post" id="inputForm"
	class='yform'>
<div id="tabs">
<ul>
	<li><a href="#tabs-1">基本信息</a></li>
	<li><a href="#tabs-2">规模概况</a></li>
	<li><a href="#tabs-3">主要技术标准</a></li>
</ul>
<div id="error" align="left"></div>
<div id="tabs-1">
<table id="basicInfo">
	<tr>
		<td>项目名称：</td>
		<td colspan="3"><input name="projName" type="text"
			value="${projName }"  />
			<input name="id" value="${id}" type="hidden" /> 
			</td>
	</tr>
	<tr>
		<td>所在的地区：</td>
		<td colspan="3" > 
			<pt:code category="4419" name="atTown" default="${atTown}"  multiple="multiple" ></pt:code>
			<div id="msg" style="display:none;" ><font color="red" style="font-family: 黑体">请选择所在地区 </font> </div>
		</td>
		</tr>
		
	<tr>
		<td>工程类型：</td>
		<td>
		<c:if test="${not empty id }">
			<pt:code  category="3001" code="${projKind}" ></pt:code>
			<input id="projKind" name="projKind" type="hidden" value="${projKind}"></input>
		</c:if>
		<c:if test="${empty id }">
			<pt:code  name="projKind" category="3001" default="${projKind}" ></pt:code>
		</c:if>
			<input name="status" value="${status }" type="hidden" /></td>
		<td>建设性质：</td>
		<td><pt:code name="buildKind" category="3002" hasEmpty="false"
		default="${buildKind}"></pt:code></td>
	</tr>
	<tr>
		<td>建设单位:</td>
		<td>
		<c:if test="${empty id }">
		<s:select name="buildOrg.id" list="ownerList" listKey="id"
			listValue="OrgName"></s:select>
		</c:if>
		<c:if test="${not empty id }">
			${orgCode.orgName}
		</c:if>	
		</td>
		<td>监督单位：</td>
		<td><pt:labels type="org" argument1="inside"
			name="superviseOrg.id" hasEmpty="false" default="${superviseOrg.id}"></pt:labels>
		</td>
	</tr>
	<tr>
		<td>计划开工时间：</td>
		<td><input id="planStartDate" name="planStartDate" type="text"
			value="<fmt:formatDate value='${planStartDate}' pattern="yyyy-MM-dd" />"></input>
		</td>
		<td>计划完工时间：</td>
		<td><input id="planEndDate" name="planEndDate" type="text"
			value="<fmt:formatDate value='${planEndDate}' pattern="yyyy-MM-dd" />" /></td>
	</tr>
	<tr>
		<td>计划工期(天)：</td>
		<td><input id="duration" name="duration" type="text" value="${duration }"  readonly="readonly"/></td>
		<td>计划年度：</td>
		<td><pt:labels name="planYear" type="yearNum" hasEmpty="false"
			default="${empty id ? time : planYear}"></pt:labels></td>
	</tr>
	<tr>
		<td>计划类型：</td>
		<td><pt:code name="planType" category="3003" hasEmpty="false"
			default="${planType}"></pt:code></td>
		<td>项目负责人：</td>
		<td><input name="principal" type="text" value="${principal }" /></td>
	</tr>
	<tr id="buildAccording">
	</tr>
	<tr>
		<td>备注：</td>
		<td colspan="3"><textarea name="remark" rows="3">${remark}</textarea></td>
	</tr>
</table>

</div>
<div id="tabs-2">
<table class="noborder">
	<tr id="budget">
		<td>工程概算(万元):</td>
		<td><input name="planInvestmentTotal" type="text"
			value="${planInvestmentTotal}" /></td>
		<td>建安投资(万元)：</td>
		<td><input name="buildInvestment" type="text"
			value="${buildInvestment}" /></td>
	</tr>
	
</table>
<div id="highway">
<table class="noborder">
	<tr>
		<td>拟建规模宽：</td>
		<td><input name="toBuildWidth" type="text"
			value="${toBuildWidth}" /></td>
		<td>总里程数(公里)：</td>
		<td><input name="toBuildLenTotal" type="text"
			value="${toBuildLenTotal}" /></td>
	</tr>
	<tr>
		<td>起止点桩号：</td>
		<td colspan="3"><input name="pegNum" type="text" value="${pegNum }" /></td>
	</tr>
	<tr>
		<td>特大桥数量：</td>
		<td><input name="superBridgeNum" type="text"
			value="${superBridgeNum }" /></td>
		<td>大桥数量：</td>
		<td><input name="largeBridgeNum" type="text"
			value="${largeBridgeNum }" /></td>
	</tr>
	<tr>
		<td>中桥数量：</td>
		<td><input name="mediumBridgeNum" type="text"
			value="${ mediumBridgeNum}" /></td>
		<td>小桥数量：</td>
		<td><input name="smallBridgeNum" type="text"
			value="${smallBridgeNum }" /></td>
	</tr>
	<tr>
		<td>涵洞数量：</td>
		<td><input name="culvertNum" type="text" value="${culvertNum }" /></td>
		<td>立交桥匝道数量：</td>
		<td><input name="overBridgeNum" type="text"
			value="${overBridgeNum }" /></td>
	</tr>
	<tr>
		<td>特长隧道数量：</td>
		<td><input name="superTunnelNum" type="text"
			value="${superTunnelNum }" /></td>
		<td>长中短隧道数量：</td>
		<td><input name="otherTunnelNum" type="text"
			value="${otherTunnelNum }" /></td>
	</tr>
</table>
</div>
<table class="noborder">
	<tr>
		<td>建设规模：</td>
		<td colspan="3"><textarea rows="4" 
			name="buildBackgroud">${buildBackgroud }</textarea></td>
	</tr>
	<tr>
		<td>主要工程量：</td>
		<td colspan="3"><textarea rows="3" cols="60" name="primeQuantity">${primeQuantity}</textarea></td>
	</tr>
	<tr>
		<td>备注：</td>
		<td colspan="3"><textarea name="remark2" rows="3">${remark2}</textarea></td>
	</tr>
</table>

</div>
<div id="tabs-3">
<div id="hidewayParam">
<table class="noborder">
	<tr>
		<td>技术标准：</td>
		<td><pt:code category="3006"  name="techGrade" prompt=""
			default="${techGrade}"></pt:code></td>
		<td>行政级别 ：</td>
		<td colspan="3"><pt:code category="3108" prompt=""
			name="socialLevel" default="${socialLevel}"></pt:code></td>
	</tr>
	<tr>
		<td>面层厚度(cm)：</td>
		<td><input name="roadsurfacePly" type="text"
			value="${roadsurfacePly }" /></td>
		<td>路基宽度(m)：</td>
		<td><input name="roadsurfaceWidth" type="text"
			value="${roadsurfaceWidth }" /></td>
	</tr>
	<tr>
		<td>车道数 ：</td>
		<td><input name="lanesNum" type="text" value="${ lanesNum}" /></td>
		<td>设计速度(km/h)：</td>
		<td><input name="designSpeed" type="text" value="${designSpeed }" /></td>
	</tr>
	<tr class="type-check">
		<td>路面类型：</td>
		<%-- 
			<td><pt:code category="3009" hasEmpty="false" name="roadType" ></pt:code></td>
		 --%>
		<td colspan="3"><pt:code category="3009" name="roadTypeSet"
			toScope="request"></pt:code> <s:checkboxlist name="roadTypeList"
			list="#request.roadTypeSet" listKey="value" listValue="label"></s:checkboxlist>
		</td>
	</tr>
</table>
</div>
<div id="waterwayParam">
<table class="noborder">
	<tr>
		<td>码头类型：</td>
		<td colspan="3"><pt:code category="3109" hasEmpty="false"
			name="wharfType" default="${wharfType}"></pt:code></td>
	</tr>
	<tr>
		<td>船舶停靠等级(吨级)：</td>
		<td><input name="tonnage" type="text" value="${tonnage}" /></td>
		<td>设计吞吐量(吨)：</td>
		<td><input name="designtonnage" type="text" value="${tonnage}" /></td>
	</tr>
	
	<tr>
		<td>码头泊位数(个):</td>
		<td><input name="berthCount" type="text" value="${berthCount }" /></td>
		<td>总长度(M)：</td>
		<td><input name="waterFront" type="text" value="${waterFront}" /></td>
	</tr>
	
	<tr>
		<td>引桥长、宽(M)：</td>
		<td><input name="approachSize" type="text" value="${approachSize}" /></td>
		<td>后方堆场面积(m2) ：</td>
		<td><input name="rearYardArea" type="text"
			value="${rearYardArea}" /></td>
	</tr>
	<tr>
		<td>配套建筑物数 ：</td>
		<td><input name="buildNum" type="text" value="${buildNum}" /></td>
	</tr>
</table>
</div>
<table class="noborder">
	<tr>
		<td>备注：</td>
		<td colspan="3"><textarea name="remark3" rows="3">${remark3}</textarea></td>
	</tr>
</table>
</div>
<div class="type-button"><input type="submit" id="sub" class="submit"
	value="提交" /> <input type="button" value="返回" class="reset"
	onclick="history.back()" /></div>
</div>
</form>
</body>
</html>